#ifndef Dialog_First
#define Dialog_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Manager.h"
#include "Window.h"

//---- Dialog ------------------------------------------------------------------

class Dialog: public Manager {
public:
	MetaDef(Dialog);

	Dialog(const char *title= 0, WindowFlags f= (WindowFlags)(eWinBlock+eWinFixed));

	virtual VObject *DoMakeActions();
	virtual VObject *DoMakeControls();

	void AboutToOpen();
	int ShowAt(VObject *fp, Point p, bool resize= FALSE, bool block= FALSE);

	void Cancel();

	virtual void EnableItem(int id, bool b= TRUE);
	void DisableItem(int id);
	VObject *FindItem(int id);

protected:
	bool AboutToDismiss();
	VObject *DoMakeContent();
	MenuBar *DoMakeMenuBar();
	Point GetInitialPos(Point e);
	Point GetInitialWindowSize();

	void Control(int id, int part, void *v);
	virtual void DoSetDefaults();
	virtual void DoSave();
	virtual void DoRestore();    // called when dialog is cancelled
	virtual void DoStore();      // called when dialog is accepted
	virtual void DoSetup();

protected:
	int actionId;
};

inline void Dialog::DisableItem(int i)
	{ EnableItem(i, FALSE); }

#endif

